package com.farsunset.cim.client.android;



import java.util.List;

import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.ChannelHandlerContext;


/**
 * Encoder/decoder delegate interface. Used to encode/decode commands between the client and the server.
 * @author
 */
public interface DelegateCodec {
    /**
     * Encodes a command.
     * @param aCtx context.
     * @param aMsg command.
     * @param aOut outbound byte buffer.
     * @throws Exception if anything goes wrong.
     */
    void encode(ChannelHandlerContext aCtx, Command aMsg, ChannelBuffer aOut) throws Exception;

    /**
     * Decodes a command.
     * @param aCtx context.
     * @param aIn byte buffer containing encoded commands.
     * @param aOut list of decoded objects.
     * @throws Exception if anything goes wrong.
     */
    void decode(ChannelHandlerContext aCtx, ChannelBuffer aIn, List<Object> aOut) throws Exception;

}
